import request from '../../utils/request';

// 专家管理相关 API

// 更新专家
export const updateExpert = (data: any) => {
    return request({
        url: '/member/api/expert',
        method: 'put',
        data
    });
};

// 创建专家
export const createExpert = (data: any) => {
    return request({
        url: '/member/api/expert',
        method: 'post',
        data
    });
};

// 查询专家详情
export const getExpertById = (id: string) => {
    return request({
        url: `/member/api/expert/${id}`,
        method: 'get'
    });
};

// 删除专家
export const deleteExpert = (id: string) => {
    return request({
        url: `/member/api/expert/${id}`,
        method: 'delete'
    });
};

// 审核专家通过
export const approveExpert = (id: string, data: any) => {
    return request({
        url: `/member/api/expert/${id}/approve`,
        method: 'post',
        data
    });
};

// 设置专家推荐状态
export const setExpertRecommend = (id: string, data: any) => {
    return request({
        url: `/member/api/expert/${id}/recommend`,
        method: 'put',
        data
    });
};

// 审核专家拒绝
export const rejectExpert = (id: string, data: any) => {
    return request({
        url: `/member/api/expert/${id}/reject`,
        method: 'post',
        data
    });
};

// 批量查询专家详情
export const getExpertsByIds = (data: any) => {
    return request({
        url: '/member/api/expert/batch',
        method: 'post',
        data
    });
};

// 查询专家列表
export const getExpertList = (params: any) => {
    return request({
        url: '/member/api/expert/list',
        method: 'get',
        params
    });
};

// 分页查询专家列表
export const getExpertPage = (params: any) => {
    return request({
        url: '/member/api/expert/page',
        method: 'get',
        params
    });
};

// 更新专家平均得分
export const updateExpertRating = (data: any) => {
    return request({
        url: '/member/api/expert/update-rating',
        method: 'post',
        data
    });
};
